package executorsDemo;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by 5406160@qq.com on LiBoWen 李博闻.
 *
 * @ClassName : Executors
 * @Author : 54061
 * @Date: 2022/2/16 9:08
 */
//创建线程池对象

public class ExecutorsDemo {
    public static void main(String[] args) {
        //创建线程池对象
        ExecutorService es1 = Executors.newFixedThreadPool(10);
        System.out.println("es1 = " + es1);
        for (int i = 0; i < 100; i++) {
        //提交线程任务
            es1.submit(new Runnable() {
                @Override
                public void run() {
                    System.out.println(Thread.currentThread().getName()+"执行了");

                }
            });

        }
        //关闭线程
        es1.shutdown();


    }
}
